package org.thingsboard.server.common.data.custom;


import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import org.thingsboard.server.common.data.BaseData;
import org.thingsboard.server.common.data.HasCustomerId;
import org.thingsboard.server.common.data.HasName;
import org.thingsboard.server.common.data.HasTenantId;
import org.thingsboard.server.common.data.id.CustomerId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.id.custom.DeviceGroupId;

/**
 * Created by miki
 * @date 2022.03.17
 * @author miki
 */
@ApiModel
@Data
@Builder
@AllArgsConstructor
public class DeviceGroup extends BaseData<DeviceGroupId> implements HasName, HasTenantId, HasCustomerId {

    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    @ApiModelProperty(position = 1, required = true, value = "设备分组名称", example = "客厅|精加工车间")
    private String name;

    //父节点id
    @ApiModelProperty(position = 2, required = true, value = "设备分组父节点id", example = "1ag532321fdsfsd")
    private DeviceGroupId parentId;
    //节点层级
    private Integer level;
    //分类标识
    private String key;
    //子分组排序
    private Integer sortIndex;

    private TenantId tenantId;
    private CustomerId customerId;
    //分组状态
    private Boolean status;

    //构造函数
    public DeviceGroup(DeviceGroupId groupId) {
        super(groupId);
    }


    @ApiModelProperty(position = 1, value = "带有报警Id的JSON对象。指定此字段以更新报警。引用不存在的报警Id将导致错误。省略此字段则创建新报警。" )
    @Override
    public DeviceGroupId getId() {
        return super.getId();
    }


    @ApiModelProperty(position = 2, value = "报警创建的时间戳，以毫秒为单位", example = "1634058704567", readOnly = true)
    @Override
    public long getCreatedTime() {
        return super.getCreatedTime();
    }

    @Override
    public CustomerId getCustomerId() {
        return customerId;
    }

    @Override
    public TenantId getTenantId() {
        return tenantId;
    }
}
